﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace Finance.Service.Implements
{
    internal static class MockAssitantor
    {
        public static TEntity GetRandomItem<TEntity>(this IEnumerable<TEntity> source)
        {

            return source != null && source.Count() != 0
                ? source.ToList()[new Random().Next(0, source.Count() - 1)]
                : default(TEntity);

        }
    }
}
